
//35.搜索插入位置
class Solution {

    int islower_bound(vector<int> nums,int target)
    {
        int left=-1;
        int right=nums.size();
        while(left+1<right)
        {
            int mid=left+(right-left)/2;
            if(nums[mid]<target) left=mid;
            else right=mid;
        }
        return right;
    }

public:
    int searchInsert(vector<int>& nums, int target) {
        //找到第一个大于target的位置
        return islower_bound(nums,target);
    }
};